package dj.interceptor.base;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

import dj.Constant;
import dj.pageModel.Puser;

/**
 * session拦截器
 * 
 */
public class SessionInterceptor extends MethodFilterInterceptor {

	protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
		Puser sessionInfo = (Puser) ServletActionContext.getRequest().getSession().getAttribute(Constant.USER_SESSION);
		if (sessionInfo == null) {
			ServletActionContext.getRequest().setAttribute("msg", "您还没有登录或登录已超时，请重新登录，然后再刷新本功能！");
			return "error";
		}
		return actionInvocation.invoke();
	}

}
